home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM33.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-15  |  4KB  |  86 lines

  1. Program Exam33;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités de Copy ,Left et Right.           }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1 ,
  14.   S2 : String;
  15.  
  16. {  ---------------------------------------------------------------         }
  17. {  Function   Copy(Str1: String;Index,Count):String;                       }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : Strictement identique à la fonction Copy de Turbo Pascal.   }
  21. {                                                                          }
  22. {  Usage     : Chaîne pascal.                                              }
  23. {                                                                          }
  24. {  Vitesse   : 7800/s                                                      }
  25. {                                                                          }
  26. { -------------------------------------------------------------------------}
  27.  
  28. Procedure Test1;
  29. Begin
  30.   S1 := 'abcdefghijklmnopqrstuvwxyz';
  31.   S2 := Copy(S1,1,13);
  32.   S2 := Copy(S1,14,50);
  33.   S2 := Copy(S1,1,1);
  34.   S2 := Copy('abcdef',6,5);
  35. end;
  36.  
  37. {  ---------------------------------------------------------------         }
  38. {  Function   Left(Str1: String;Count: Integer):String;                    }
  39. {  ---------------------------------------------------------------         }
  40. {                                                                          }
  41. {  Effet     : Retourne la partie gauche de <Str1>.                        }
  42. {              Equivalent à Copy(Str1,1,Count).                            }
  43. {                                                                          }
  44. {  Usage     : Chaîne pascal.                                              }
  45. {                                                                          }
  46. {  Vitesse   : 7800/s                                                      }
  47. {                                                                          }
  48. { -------------------------------------------------------------------------}
  49.  
  50. Procedure Test2;
  51. Begin
  52.   S1 := 'abcdefghijklmnopqrstuvwxyz';
  53.   S2 := Left(S1,13);
  54.   S2 := Left(S1,5);
  55.   S2 := Left(S1,50);
  56.   S2 := Left('abcde',2);
  57. end;
  58.  
  59. {  ---------------------------------------------------------------         }
  60. {  Function     Right(Str1: String;Count: Integer):String;                 }
  61. {  ---------------------------------------------------------------         }
  62. {                                                                          }
  63. {  Effet     : Retourne <Count> caractères de la partie droite de <Str1>.  }
  64. {                                                                          }
  65. {  Usage     : Chaîne pascal.                                              }
  66. {                                                                          }
  67. {  Vitesse   : 7800/s                                                      }
  68. {                                                                          }
  69. { -------------------------------------------------------------------------}
  70.  
  71. Procedure Test3;
  72. Begin
  73.   S1 := 'abcdefghijklmnopqrstuvwxyz';
  74.   S2 := Right(S1,13);
  75.   S2 := Right(S1,50);
  76.   S2 := Right('abcde',6);
  77. end;
  78.  
  79. Begin
  80.   Test1;
  81.   Test2;
  82.   Test3;
  83. End.
  84.  
  85. { -------------------------------------------------------------------------}
  86.